package com.mr.model;

import java.sql.Timestamp;

import com.mr.util.DateUtil;

public class GoodsOrder extends BaseObject {
	private static final long serialVersionUID = -1201269934556443907L;
	private Long id;
	private Long memberid;
	private Long goodsid;
	private Integer quantity;
	private Integer price;
	private String status;
	private Timestamp addtime;	
	public GoodsOrder(){
		this.addtime = DateUtil.getCurTimestamp();
		this.status = Status.Y;
	}
	public GoodsOrder(Long memberid, Long goodsid, Integer quantity, Integer price){
		this();
		this.memberid = memberid;
		this.goodsid = goodsid;
		this.quantity = quantity;
		this.price = price;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public Timestamp getAddtime() {
		return addtime;
	}
	public void setAddtime(Timestamp addtime) {
		this.addtime = addtime;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public Long getMemberid() {
		return memberid;
	}
	public void setMemberid(Long memberid) {
		this.memberid = memberid;
	}
	public Long getGoodsid() {
		return goodsid;
	}
	public void setGoodsid(Long goodsid) {
		this.goodsid = goodsid;
	}
	public Integer getQuantity() {
		return quantity;
	}
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}
	public Integer getTotalfee(){
		return this.quantity*this.price;
	}
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (!(o instanceof GoodsOrder))
			return false;

		final GoodsOrder temp = (GoodsOrder) o;

		return !(this.getId() != null ? !(this.getId().equals(temp.getId()))
				: (temp.getId() != null));

	}

	public int hashCode() {
		return (this.getId() != null ? this.getId().hashCode() : 0);
	}
	public Integer getPrice() {
		return price;
	}
	public void setPrice(Integer price) {
		this.price = price;
	}
}
